package com.zjj.learn.algorithmPlus.segment1.recursion;

/**
 * @author zjj_admin
 * @date 2023/7/1 16:55
 */
public class Factorial {


    /**
     * 使用递归求就一个数的阶乘
     *
     * @param n
     * @return
     */
    public static int factorial(int n) {
        if (n <= 1) {
            return 1;
        }
        return n * factorial(n - 1);
    }
}
